import request from '@/utils/request';
export type ParamsType = {
  type: 'a' | 'c';
  source: string;
};
export const getCommentsByIdAPI = (params: ParamsType) => {
  return request({
    url: '/v1_0/comments',
    params,
  });
};

// 发表评论api
export type commentType = {
  target: string;
  content: string;
  art_id?: string;
};
export const submitCommentAPI = (data: commentType) => {
  return request({
    url: '/v1_0/comments',
    method: 'post',
    data,
  });
};

// 点赞
export const commentLikeAPI = (id: string) => {
  return request({
    url: '/v1_0/comment/likings',
    method: 'POST',
    data: {
      target: id,
    },
  });
};

export const commentDislikeAPI = (id: string) => {
  return request({
    url: '/v1_0/comment/likings/' + id,
    method: 'DELETE',
  });
};
